using System.Collections.Generic;

namespace ColladaDotNet
{
	public partial class node : ColladaXmlNode
	{
		public override string GetId() { return id; }
		public override string GetSid() { return sid; }
		public override IList<ColladaXmlNode> ChildNodes
		{
			get
			{
				var list = new List<ColladaXmlNode>();
				if (Items != null)
					foreach (object e in Items) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (instance_camera != null)
					foreach (object e in instance_camera) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (instance_controller != null)
					foreach (object e in instance_controller) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (instance_geometry != null)
					foreach (object e in instance_geometry) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (instance_light != null)
					foreach (object e in instance_light) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (instance_node != null)
					foreach (object e in instance_node) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (node1 != null)
					foreach (object e in node1) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (extra != null)
					foreach (object e in extra) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (layer != null)
					foreach (object e in layer) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (asset != null)
					list.Add(asset);
				return list;
			}

			
		}
		[System.Xml.Serialization.XmlIgnore]
		public matrix Matrix
		{
			get
			{
				foreach (var item in Items)
				{
					if (item is matrix)
						return (matrix)item;
				}
				return null;
			}
			set
			{
				for (int i = 0; i < Items.Length; i++)
				{
					var item = Items[i];
					if (item is matrix)
					{
						Items[i] = value;
						return;
					}
				}
				COLLADA.AddToArray(Items, value);
			}
		}
	}
}
